<template>
	<view class="box inner">
		<text class="title">爆款秒杀</text>
		<view class="list">
			<view class="item" v-for="item in list" :key="item.id" @click="openDetail(item)">
				<image :src="item.image" mode="aspectFill"></image>
				<view class="label">{{item.name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				
			}
		},
		props: {
			list: {
				type: Array,
				default: ()=>[]
			}
		},
		methods: {
			openDetail(item){
				uni.navigateTo({
				  url: "/pages/goodsDetails/goodsDetails?id=" + item.id,
				});
			}
		}
		
	}
</script>

<style scoped lang="scss">
	.box{
		margin-top: 20rpx;
		.title{
			font-size: 30rpx;
			font-weight: bold;
		}
		.list{
			margin-top: 22rpx;
			display: grid;
			grid-template-columns: repeat(4, 155rpx);
			justify-content: space-between;
			grid-template-rows: 212rpx;
			.item{
				position: relative;
				.label{
					font-size: 20rpx;
					background-color: #fff;
					position: absolute;
					bottom: 10rpx;
					left: 50%;
					transform: translateX(-50%) scale(.8);
					white-space: nowrap;
					padding: 2rpx 12rpx;
					border-radius: 100rpx;
					max-width: 90%;
					@extend .text-hidden;
				}
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
	}
</style>